<!-- Load TinyMCE -->
<script type="text/javascript" src="media/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="media/tiny_mce/config.js"></script>
<script type="text/javascript">
	tiny('detail[th],detail[en]');
	$(function(){
			$("[rel=en]").hide();
			$(".lang a").click(function(){
				$("[rel=" + $(this).attr("href") + "]").show().siblings().hide();
				$(this).addClass('active').siblings().removeClass('active');
				return false;
			})
			$("input[name=tag]").tagEditor({
				<?php if($cover->tag):?>
				items: '<?php echo $cover->tag?>'.split(","),
				<?php endif; ?>
				continuousOutputBuild:true
				});	
	})
</script>
<h1>หน้าแรก</h1>
<form action="covers/admin/covers/save/<?php echo $cover->id ?>" method="post" enctype="multipart/form-data" >
	
<table class="form">
	<tr><th></th><td class="lang"><a href="th" class="active flag th">ไทย</a><a href="en" class="flag en">อังกฤษ</a></td></tr>
	<?php if(is_file('uploads/cover/'.$cover->image)): ?>
	<tr><th></th><td><img class="img" src="<?php echo 'uploads/cover/'.$cover->image?>"  /></td></tr>
	<?php endif; ?>
	<tr><th>รูปภาพ </th><td><input type="file" name="image" /></td></tr>
	<tr><th>เริ่ม </th><td><input type="text" name="start_date" value="<?php echo DB2Date($cover->start_date)?>" class="datepicker" /></td></tr>
	<tr><th>สิ้นสุด </th><td><input type="text" name="end_date" value="<?php echo DB2Date($cover->end_date)?>" class="datepicker" /></td></tr>
	<tr>
		<th>หัวข้อ </th>
		<td>
			<input type="text" name="title[th]" rel="th" value="<?php echo lang_decode($cover->title,'th')?>" class="full" />
			<input type="text" name="title[en]" rel="en" value="<?php echo lang_decode($cover->title,'en')?>" class="full" />
		</td>
	</tr>
	<tr>
		<th></th>
		<td>
			<?php echo form_submit('',lang('btn_submit'),'class="button"')?>
			<?php echo form_button('',lang('btn_back'),'class="button" onclick="window.location = \'covers/admin/covers/index/\'"')?>
		</td></tr>
</table>
</form>